We were not quite using all the right dimensions.
GskVulkanColorTextInstance *instances = (GskVulkanColorTextInstance *) data;
int i, count;
int x_position = 0;
- float ascent;
- float height;
+ float dx, dy, dw, dh;
count = 0;
for (i = 0; i < glyphs->num_glyphs; i++)
&instance->tex_rect[1],
&instance->tex_rect[2],
&instance->tex_rect[3],
- &ascent, &height);
- instance->rect[0] = x + cx;
- instance->rect[1] = y + cy - ascent;
- instance->rect[2] = PANGO_PIXELS_CEIL (gi->geometry.width);
- instance->rect[3] = height;
+ &dx, &dy, &dw, &dh);
+ instance->rect[0] = x + cx + dx;
+ instance->rect[1] = y + cy + dy;
+ instance->rect[2] = dw;
+ instance->rect[3] = dh;
count++;
}
float *ty,
float *tw,
float *th,
- float *ascent,
- float *height)
+ float *dx,
+ float *dy,
+ float *dw,
+ float *dh)
{
GlyphCacheValue *gv;
*ty = gv->ty;
*tw = gv->tw;
*th = gv->th;
- *ascent = - gv->draw_y;
- *height = gv->draw_height;
+ *dx = gv->draw_x;
+ *dy = gv->draw_y;
+ *dw = gv->draw_width;
+ *dh = gv->draw_height;
}
}
return;
cairo_set_scaled_font (cr, scaled_font);
- cairo_set_source_rgba (cr, 0, 0, 0, 1);
+ cairo_set_source_rgba (cr, 1, 1, 1, 1);
cg.index = glyph;
- cg.x = cache->x;
+ cg.x = cache->x - value->draw_x;
cg.y = cache->y0 - value->draw_y;
cairo_show_glyphs (cr, &cg, 1);
cache->x = cache->x + value->draw_width + 1;
cache->y = MAX (cache->y, cache->y0 + value->draw_height + 1);
- value->tx = cg.x / cache->width;
+ value->tx = (cg.x + value->draw_x) / cache->width;
value->ty = (cg.y + value->draw_y) / cache->height;
value->tw = (float)value->draw_width / cache->width;
value->th = (float)value->draw_height / cache->height;
float *ty,
float *tw,
float *th,
- float *ascent,
- float *height);
+ float *dx,
+ float *dy,
+ float *dw,
+ float *dh);
void gsk_vulkan_renderer_cache_glyphs (GskVulkanRenderer *renderer,
PangoFont *font,
GskVulkanTextInstance *instances = (GskVulkanTextInstance *) data;
int i, count;
int x_position = 0;
- float ascent;
- float height;
+ float dx, dy, dw, dh;
count = 0;
for (i = 0; i < glyphs->num_glyphs; i++)
&instance->tex_rect[1],
&instance->tex_rect[2],
&instance->tex_rect[3],
- &ascent, &height);
- instance->rect[0] = x + cx;
- instance->rect[1] = y + cy - ascent;
- instance->rect[2] = PANGO_PIXELS_CEIL (gi->geometry.width);
- instance->rect[3] = height;
+ &dx, &dy, &dw, &dh);
+ instance->rect[0] = x + cx + dx;
+ instance->rect[1] = y + cy + dy;
+ instance->rect[2] = dw;
+ instance->rect[3] = dh;
instance->color[0] = color->red;
instance->color[1] = color->green;
instance->color[2] = color->blue;